package com.ch3;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

@Slf4j(topic = "c.Thread")
public class ThreadDemo_04 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<String> task = new FutureTask<>(()-> {
            log.info("debug--------------------------------");
            Thread.sleep(2000);
            return "100";
        });

        new Thread(task).start();

        log.info("{}",task.get());
    }
}
